import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/duty/major_event_entity.dart';

MajorEventEntity $MajorEventEntityFromJson(Map<String, dynamic> json) {
  final MajorEventEntity majorEventEntity = MajorEventEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    majorEventEntity.id = id;
  }
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    majorEventEntity.companyId = companyId;
  }
  final String? companyName = jsonConvert.convert<String>(json['companyName']);
  if (companyName != null) {
    majorEventEntity.companyName = companyName;
  }
  final String? reportCompanyName = jsonConvert.convert<String>(json['reportCompanyName']);
  if (reportCompanyName != null) {
    majorEventEntity.reportCompanyName = reportCompanyName;
  }
  final String? dept = jsonConvert.convert<String>(json['dept']);
  if (dept != null) {
    majorEventEntity.dept = dept;
  }
  final String? dutyPerson = jsonConvert.convert<String>(json['dutyPerson']);
  if (dutyPerson != null) {
    majorEventEntity.dutyPerson = dutyPerson;
  }
  final String? dutyPersonPhone = jsonConvert.convert<String>(json['dutyPersonPhone']);
  if (dutyPersonPhone != null) {
    majorEventEntity.dutyPersonPhone = dutyPersonPhone;
  }
  final String? dutyLeader = jsonConvert.convert<String>(json['dutyLeader']);
  if (dutyLeader != null) {
    majorEventEntity.dutyLeader = dutyLeader;
  }
  final String? dutyLeaderPhone = jsonConvert.convert<String>(json['dutyLeaderPhone']);
  if (dutyLeaderPhone != null) {
    majorEventEntity.dutyLeaderPhone = dutyLeaderPhone;
  }
  final String? eventTime = jsonConvert.convert<String>(json['eventTime']);
  if (eventTime != null) {
    majorEventEntity.eventTime = eventTime;
  }
  final String? eventAddr = jsonConvert.convert<String>(json['eventAddr']);
  if (eventAddr != null) {
    majorEventEntity.eventAddr = eventAddr;
  }
  final String? eventDesc = jsonConvert.convert<String>(json['eventDesc']);
  if (eventDesc != null) {
    majorEventEntity.eventDesc = eventDesc;
  }
  final String? eventReason = jsonConvert.convert<String>(json['eventReason']);
  if (eventReason != null) {
    majorEventEntity.eventReason = eventReason;
  }
  final String? measure = jsonConvert.convert<String>(json['measure']);
  if (measure != null) {
    majorEventEntity.measure = measure;
  }
  final int? measureWay = jsonConvert.convert<int>(json['measureWay']);
  if (measureWay != null) {
    majorEventEntity.measureWay = measureWay;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    majorEventEntity.remark = remark;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    majorEventEntity.createTime = createTime;
  }
  return majorEventEntity;
}

Map<String, dynamic> $MajorEventEntityToJson(MajorEventEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['companyId'] = entity.companyId;
  data['companyName'] = entity.companyName;
  data['reportCompanyName'] = entity.reportCompanyName;
  data['dept'] = entity.dept;
  data['dutyPerson'] = entity.dutyPerson;
  data['dutyPersonPhone'] = entity.dutyPersonPhone;
  data['dutyLeader'] = entity.dutyLeader;
  data['dutyLeaderPhone'] = entity.dutyLeaderPhone;
  data['eventTime'] = entity.eventTime;
  data['eventAddr'] = entity.eventAddr;
  data['eventDesc'] = entity.eventDesc;
  data['eventReason'] = entity.eventReason;
  data['measure'] = entity.measure;
  data['measureWay'] = entity.measureWay;
  data['remark'] = entity.remark;
  data['createTime'] = entity.createTime;
  return data;
}

extension MajorEventEntityExtension on MajorEventEntity {
  MajorEventEntity copyWith({
    int? id,
    int? companyId,
    String? companyName,
    String? reportCompanyName,
    String? dept,
    String? dutyPerson,
    String? dutyPersonPhone,
    String? dutyLeader,
    String? dutyLeaderPhone,
    String? eventTime,
    String? eventAddr,
    String? eventDesc,
    String? eventReason,
    String? measure,
    int? measureWay,
    String? remark,
    String? createTime,
  }) {
    return MajorEventEntity()
      ..id = id ?? this.id
      ..companyId = companyId ?? this.companyId
      ..companyName = companyName ?? this.companyName
      ..reportCompanyName = reportCompanyName ?? this.reportCompanyName
      ..dept = dept ?? this.dept
      ..dutyPerson = dutyPerson ?? this.dutyPerson
      ..dutyPersonPhone = dutyPersonPhone ?? this.dutyPersonPhone
      ..dutyLeader = dutyLeader ?? this.dutyLeader
      ..dutyLeaderPhone = dutyLeaderPhone ?? this.dutyLeaderPhone
      ..eventTime = eventTime ?? this.eventTime
      ..eventAddr = eventAddr ?? this.eventAddr
      ..eventDesc = eventDesc ?? this.eventDesc
      ..eventReason = eventReason ?? this.eventReason
      ..measure = measure ?? this.measure
      ..measureWay = measureWay ?? this.measureWay
      ..remark = remark ?? this.remark
      ..createTime = createTime ?? this.createTime;
  }
}